import type { DirectiveHook } from 'vue'

const handler: DirectiveHook = (el, binding) => {
  let result = binding.value || '-'
  if (
    result === '' ||
    result === undefined ||
    result === null ||
    (Array.isArray(result) && result.length === 0)
  ) {
    result = '-'
  }
  el.textContent = result
}

export default handler
